'use strict';

export default function patentManagement(state = {}, action) {
  switch (action.type) {
    case 'GET_PATENT_LIST_SUCCESS':
      return { ...state, patentList: action.payload };
    case 'GET_PATENT_LIST_FAILURE':
      return { ...state, patentList: null, error: action.payload };
      
    case 'EDIT_PATENT_SUCCESS':
      return { ...state, editPatentResult: action.payload };
    case 'EDIT_PATENT_FAILURE':
      return { ...state, editPatentResult: null, error: action.payload };
      
    case 'DELETE_PATENT_SUCCESS':
      return { ...state, deletePatentResult: action.payload };
    case 'DELETE_PATENT_FAILURE':
      return { ...state, deletePatentResult: null, error: action.payload };
      
    case 'IMPORT_PATENTS_SUCCESS':
      return { ...state, importPatentsResult: action.payload };
    case 'IMPORT_PATENTS_FAILURE':
      return { ...state, importPatentsResult: null, error: action.payload };
      
    case 'CHANGE_PATENTEE_SUCCESS':
      return { ...state, changePatenteeResult: action.payload };
    case 'CHANGE_PATENTEE_FAILURE':
      return { ...state, changePatenteeResult: null, error: action.payload };
      
    case 'EXPORT_PATENTS_SUCCESS':
      return { ...state, exportPatentsResult: action.payload };
    case 'EXPORT_PATENTS_FAILURE':
      return { ...state, exportPatentsResult: null, error: action.payload };
      
    case 'GET_PATENT_TEMPLATE_SUCCESS':
      return { ...state, patentTemplateResult: action.payload };
    case 'GET_PATENT_TEMPLATE_FAILURE':
      return { ...state, patentTemplateResult: null, error: action.payload };
      
    default:
      return state;
  }
} 